package com.edu.modules.comm;

import com.sari.common.utils.DateUtils;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Utils {

    public static List<Map> getDateList(){

        List<Map> dateList = new ArrayList();
        String pattern = "MM-dd";
        String nowYear =  DateUtils.getDate("yyyy");
        String nowDate = DateUtils.getDate(pattern);
        if(DateUtils.compareDate("01-01",nowDate,pattern)&&
                DateUtils.compareDate(nowDate,"06-30",pattern)){
            Map m1 = new HashMap();
            m1.put("startDate",nowYear+"-03-01");
            m1.put("endDate",nowYear+"-06-30");
            dateList.add(m1);

            Map m2 = new HashMap();
            m2.put("startDate",String.valueOf(Integer.valueOf(nowYear)-1)+"-09-01");
            m2.put("endDate",nowYear+"-01-31");
            dateList.add(m2);

            Map m3 = new HashMap();
            m3.put("startDate",String.valueOf(Integer.valueOf(nowYear)-1)+"-07-01");
            m3.put("endDate",String.valueOf(Integer.valueOf(nowYear)-1)+"-08-30");
            dateList.add(m3);
        }
        if(DateUtils.compareDate("07-01",nowDate,pattern)&&
                DateUtils.compareDate(nowDate,"08-30",pattern)){
            Map m1 = new HashMap();
            m1.put("startDate",nowYear+"-07-01");
            m1.put("endDate",nowYear+"-08-30");
            dateList.add(m1);

            Map m2 = new HashMap();
            m2.put("startDate",nowYear+"-03-01");
            m2.put("endDate",nowYear+"-06-30");
            dateList.add(m2);

            Map m3 = new HashMap();
            m3.put("startDate",String.valueOf(Integer.valueOf(nowYear)-1)+"-09-01");
            m3.put("endDate",nowYear+"-01-31");
            dateList.add(m3);
        }
        if(DateUtils.compareDate("09-01",nowDate,pattern)&&
                DateUtils.compareDate(nowDate,"12-31",pattern)){
            Map m3 = new HashMap();
            m3.put("startDate",nowYear+"-09-01");
            m3.put("endDate",nowYear+"-12-31");
            dateList.add(m3);

            Map m1 = new HashMap();
            m1.put("startDate",nowYear+"-07-01");
            m1.put("endDate",nowYear+"-08-30");
            dateList.add(m1);

            Map m2 = new HashMap();
            m2.put("startDate",nowYear+"-03-01");
            m2.put("endDate",nowYear+"-06-30");
            dateList.add(m2);
        }
        return dateList;
    }
}
